import { componentRegistry } from './componentRegistry'
import { SPECIAL_TYPES } from './registerElementComponents'
import type { ComponentType, childrenType } from '../types/types'

/**
 * 根据传入的 ComponentType 类型字符串返回对应的组件或特定字符串
 * @param type - ComponentType 类型的字符串
 * @returns 对应的组件、'slot' 字符串
 */
export function getComponentByType(type: ComponentType | childrenType) {
  if (type === SPECIAL_TYPES.slot) {
    return type
  }
  return componentRegistry.getComponent(type)
}

// 初始化组件注册
import './registerElementComponents'
